import React, { useEffect } from 'react';

export default function Proto() {
    useEffect(() => {
        // 扁平化1
        function flattenDeep(arr) { 
            return arr.reduce((pre, cur) => { return pre.concat( Array.isArray(cur) ? flattenDeep(cur) : cur); }, []);
        }
        // 扁平化2
        function flatten(arr) {
            let result = [];
            for (let i = 0, len = arr.length; i < len; i++) {
                if (Array.isArray(arr[i])) {
                    result = result.concat(flatten(arr[i]));
                } else {
                    result.push(arr[i]);
                }
            }
            return result;
        }
        
        // 测试
        var test = ['a', ['b', 'c'], ['d', ['e', ['f']], 'g']];
        console.log(flatten(test));
    });
    return (
        <div>
            404页4444面
        </div>
    );
}